using System;
using System.Collections.Generic;
using UnityEngine;

namespace Features
{
    [CreateAssetMenu(fileName = "LifeSteal", menuName = "Features/生命偷取")]
    public class LifeSteal : Feature
    {
        public PropertyChange.TargetType TargetPawn = PropertyChange.TargetType.Self;
        public float HealValue;
        public bool ifAttak;
        public override void CancleEffect(FeatureEventArgs args)
        {

        }

        public override void ExecuteEffect(FeatureEventArgs args)
        {
            Pawn target = args.pawn;
            if (TargetPawn == PropertyChange.TargetType.SelfHero)
            {
                target = GridManager.instance.GetGridNode(1, 1).Pawn;;
            }
            if (TargetPawn == PropertyChange.TargetType.EnemyHero)
            {
                target = GridManager.instance.GetGridNode(6, 1).Pawn;;
            }

            if(ifAttak)
                target.Heal(args.Damage);
            else
                target.Heal(HealValue);
        }

        public override string GetDescription()
        {
            string targetText = "自身";
            if (TargetPawn == PropertyChange.TargetType.SelfHero)
            {
                targetText = "己方英雄";
            }
            if (TargetPawn == PropertyChange.TargetType.EnemyHero)
            {
                targetText = "对方英雄";
            }

            return GetTriggerText() + "为"+targetText + "恢复相应生命值";
        }
    }
}